/**
 * 反转链表
 * @param {ListNode} head
 * 解法1：用栈保存信息 
 */
var reverseList = function (head) {
    // 定义3个指针
    let prev = null
    let curr = head
    let next = head
    while (curr !== null) {
        next = curr.next
        curr.next = prev
        prev = curr
        curr = next
    }
    // ES6写法
    while (curr !== null) {
        // 取消next变量，用curr.next代替
        // 解构赋值条件下三个变量的修改没有先后顺序，都是当前值
        [curr.next, prev, curr] = [prev, curr, curr.next]
    }
    return prev
}